package review;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Demo {
    public static void main(String[] args) {
        int n = 0;
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入一个字符串:");
        String str = sc.nextLine();
        System.out.println("请给定一个字符:");
        char word = sc.nextLine().charAt(0);
        for (int i = 0; i < str.length(); i++) {
            if (str.charAt(i)==word) {
                n++;
            }
        }
        System.out.println("次数:"+n);
    }
}

class BankAccount{
    String name;
    String id;
    double Money;

    public BankAccount(String name, String id, double money) {
        this.name = name;
        this.id = id;
        Money = money;
    }

    void deposit(double amount) {
        Money += amount;
    }

    void withdraw(double amount) {
        Money -= amount;
    }

    public double getBalance() {
        return this.Money;
    }
}

class BankAccountManager{
    Scanner sc = new Scanner(System.in);
    List<BankAccount> bankAccounts = new ArrayList<BankAccount>();
    void addAccount(BankAccount account) {

    }
    void removeAccount(BankAccount account) {
        bankAccounts.remove(account);
    }

    void getAccount(String id) {
        for (BankAccount acc : bankAccounts) {
            if (acc.id.equals(id)) {
                System.out.println(acc.Money);
            }
        }
    }

    public static void main(String[] args) {
        BankAccountManager manager = new BankAccountManager();
//        manager.addAccount(new BankAccount());
//        manager.addAccount(new BankAccount());
//        manager.addAccount(new BankAccount());
        //查找某个账号的
    }
}
